home *** CD-ROM | disk | FTP | other *** search
- Path: news.uh.edu!usenet
- From: Sensarn <txs53132@bayou.uh.edu>
- Newsgroups: comp.lang.c++
- Subject: Re: Why won't this work?
- Date: 16 Mar 1996 18:20:18 GMT
- Organization: AEtna Insurance Agency
- Message-ID: <4if0p2$ps6@masala.cc.uh.edu>
- References: <4icjqa$km4@masala.cc.uh.edu> <314AEA07.B60@airmail.net>
- NNTP-Posting-Host: sip-14256.public-dialups.uh.edu
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.1 (Windows; U; 16bit)
-
- Mark Nelson <markn@airmail.net> wrote:
- >Sensarn wrote:
- >>
- >> struct human {
- >> int age;
- >> };
- >>
- >> void main(void) {
- >> human bob;
- >> asm mov ax,bob.age; /* Expression Syntax error here */
- >> }
- >>
- >> Please help
- >>
- >
- >While most MS-DOS/Windows compilers support some sort of in-line assembly,
- >their capabilities differe greatly. You need to specify which compiler
- >you are using in order to determine what it can and cannot do. For example,
- >if you are using Watcom, the code shown above will never work, because
- >you have to put your asm code in a function definition via pragma.
- >
- >I use inline assembly in one place in Greenleaf ArchiveLib, and it
- >is a horrible looking mess of #ifdefs and hacks, since I'm supporting
- >a whole bunch of different compilers. Ugh.
-
- I can use the inline assembler with ANY variable (almost) except class
- members. Should I just use another variable as a representation:
-
- struct human {
- int age;
- };
-
- void main(void) {
- human bob;
- int bobsage=bob.age;
- asm mov ax,bobsage; /* Works now? */
- }
-
- That works...
-
- >
- >Mark Nelson
- >http://web2.airmail.net/markn
-
-
- --
- ______________________________
-
- Steven Sensarn
- E-Mail - txs53132@bayou.uh.edu
- ______________________________
-
-
-